﻿<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
</head>

<body>
@{
    RMS.Models.RMSDataClassesDataContext db = new RMS.Models.RMSDataClassesDataContext();
    int waitForApprove = db.Problems.Where(x => x.IsShared && !x.ApprovalUserId.HasValue && !x.IsDeclined).Count();
    waitForApprove += db.BestPractices.Where(x => x.IsShared && !x.ApprovalUserId.HasValue && !x.IsDeclined).Count();
    string s = "";
    if(waitForApprove != 0)
    {
        s += " (" + waitForApprove.ToString() + ")";
    }
}
    <div class="page">

        <div id="header">
            <div id="title">
                <h1>CMU Risk Management System</h1>
            </div>

            <div id="logindisplay">
                @Html.Partial("_LogOnPartial")
            </div>

            <div id="menucontainer">

                <ul id="menu">
                    <li>@Html.ActionLink("Overview", "Overview", "Problem")</li>
                    @if (Request.IsAuthenticated)
                    {
                        var user = db.Users.FirstOrDefault(x => x.UserName == Membership.GetUser().UserName);
                        if (user.CompanyId.HasValue)
                        {
                            <li>@Html.ActionLink("Company Overview", "Overview", "Company", new { id = user.CompanyId.Value }, null)</li>
                        }
                    }
                    <li>@Html.ActionLink("Companies","Index","Company")</li>
                    <li>@Html.ActionLink("Products", "Index", "Product")</li>
                    <li>@Html.ActionLink("Problems", "Index", "Problem")</li>
                    @if (Request.IsAuthenticated)
                    {
                    <li>@Html.ActionLink("My Profile", "SelfDetails", "User")</li>
                   
                        if (!string.IsNullOrEmpty(s))
                        {
                        <li>@Html.ActionLink("Wait for Approve" + s, "WaitForApproveList", "Problem")</li>
                        }
                    }
                </ul>

            </div>
        </div>

        <div id="main">
            @RenderBody()
            <div id="footer">
            </div>
        </div>
    </div>
</body>
</html>
